<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('设备预警单列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>变电站名称：</label>
                                <input type="text" name="substationName"/>
                            </li>
                            <li>
                                <label>物资名称：</label>
                                <input type="text" name="deviceName"/>
                            </li>
                            <li>
                                <label>规格型号：</label>
                                <input type="text" name="deviceModel"/>
                            </li>
                            <li>
                                <label>单位：</label>
                                <input type="text" name="unit"/>
                            </li>
                            <li>
                                <label>数量：</label>
                                <input type="text" name="amount"/>
                            </li>
                            <li>
                                <label>申请时间：</label>
                                <input type="text" class="time-input" placeholder="请选择申请时间" name="startTime"/>
                            </li>
                            <li>
                                <label>交货时间：</label>
                                <input type="text" class="time-input" placeholder="请选择交货时间" name="overTime"/>
                            </li>
                            <li>
                                <label>经手人：</label>
                                <input type="text" name="overLeader"/>
                            </li>
                            <li>
                                <label>交货地点：</label>
                                <input type="text" name="delivery"/>
                            </li>
                            <li>
                                <label>申请人及联系方式：</label>
                                <input type="text" name="startLeader"/>
                            </li>
                            <li>
                                <label>厂商名称：</label>
                                <input type="text" name="supplierName"/>
                            </li>
                            <li>
                                <label>用途：</label>
                                <input type="text" name="purpose"/>
                            </li>
                            <li>
                                <label>紧急情况：</label>
                                <input type="text" name="emergency"/>
                            </li>
                            <li>
                                <label>是否停电：</label>
                                <input type="text" name="powerCut"/>
                            </li>
                            <li>
                                <label>位置编号：</label>
                                <input type="text" name="locationNumber"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:warning:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:warning:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:warning:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <!--        新增导出按钮        -->
                <a class="btn btn-info" onclick="$.table.importExcel()" shiro:hasPermission="system:supplier:import">
                    <i class="fa fa-upload"></i> 导入
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:warning:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:warning:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:warning:remove')}]];
        var prefix = ctx + "system/warning";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                <!--        新增导出链接        -->
                importUrl: prefix + "/importData",
                importTemplateUrl: prefix + "/importTemplate",
                modalName: "设备预警单",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'dewId',
                    title: '预警单id',
                    visible: false
                },
                {
                    field: 'substationName',
                    title: '变电站名称'
                },
                {
                    field: 'deviceName',
                    title: '物资名称'
                },
                {
                    field: 'deviceModel',
                    title: '规格型号'
                },
                {
                    field: 'unit',
                    title: '单位'
                },
                {
                    field: 'amount',
                    title: '数量'
                },
                {
                    field: 'startTime',
                    title: '申请时间'
                },
                {
                    field: 'overTime',
                    title: '交货时间'
                },
                {
                    field: 'overLeader',
                    title: '经手人'
                },
                {
                    field: 'delivery',
                    title: '交货地点'
                },
                {
                    field: 'startLeader',
                    title: '申请人及联系方式'
                },
                {
                    field: 'supplierName',
                    title: '厂商名称'
                },
                {
                    field: 'purpose',
                    title: '用途'
                },
                {
                    field: 'emergency',
                    title: '紧急情况'
                },
                {
                    field: 'powerCut',
                    title: '是否停电'
                },
                {
                    field: 'locationNumber',
                    title: '位置编号'
                },
                {
                    field: 'remark',
                    title: '备注'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.dewId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.dewId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
<!-- 新增导入区域，并修改文字信息 -->
<script id="importTpl" type="text/template">
    <form enctype="multipart/form-data" class="mt20 mb10">
        <div class="col-xs-offset-1">
            <input type="file" id="file" name="file"/>
            <div class="mt10 pt5">
                <input type="checkbox" id="updateSupport" name="updateSupport" title="如果设备预警单已经存在，更新这条数据。"> 是否更新已经存在的设备预警单
                &nbsp;	<a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
            </div>
            <font color="red" class="pull-left mt10">
                提示：仅允许导入“xls”或“xlsx”格式文件！
            </font>
        </div>
    </form>
</script>
</html>